Added java doc and comments