Added Javadoc and comments