add javadoc and remove test code