added javadoc
added tests
tested