Cleaned up code in preparation for Windows build