added some javadoc and fixed style