Added more javadocs and modified a few methods.