Moved input handling to InputManager class.