reorganized mouse input and added javadocs