Refactoring code, cleaning up, adding/removing javadocs