refactored main class and added javadoc
added javadoc