Additional JavaDoc and improvements to the readablility of the code