Clean the code add javadoc