Code cleanup, re-ordered methods, added javadoc to existing methods.