Updated code and javadocs