initial code
added javadoc and junit tests