added more tests and some javadoc