Write Javadoc and fix minor details