Comment for last commit:

Added javadocs and cleaned up the code a bit.