tested, improved some comments and javadocs