Added javadoc and fixed trailing spaces