Cleanup and adding javadocs