Added tons of javadoc comments and did code cleaning