clean code, add javadoc