javadocs

Commented the code and added documentation