Added javadoc dir, refactored code.