Updated documentation and added some javadocs.