added a lot of javadoc