ported InputManager and cleaned up window a bit