Fix coding style, add some javadoc
Improve javadoc