Added javadoc and refactored the mvc structure