updated comments and javadocs and small fixes