formatted javadoc
optimized by removing one sort cycle