Huge update to make the project more Windows-friendly, plus some general refactoring and bug-fixing.