Some refactoring, no functionality change. Created an input manager to
handle all the mouse and keyboard input.