Changes to allow better cross-platform building. Tested on Windows and Linux