First round of Javadoc writing + refactoring