added javadoc and bugfix