Added javadoc comments; minor code cleanup