Fixed previous bad commit. Refactored some generator & mouse input code.