Code reorganization and added javadocs for classes that will be exposed to outside users