added javadocs and comments.