#JC-1254 Started refactoring and adding javadocs