Cleaned up mouse input/motion handler, other misc cleanup