Improved some javadoc in code.
Also refactoring to a more tree-like structure.