Commented the code and generated javadoc for it