Fix bugs and refactoring after GameWindow.js merging