Refactored mouse input