added some javadoc and cleaned up the Main