cleanup, javadoc and some comments