added javadoc comments and some changes