Refactoring of MouseDevice.