Refactor mouse actions