more javadocs and beautify code