big refactoring for main game panel coffeescript code