more more javadocing and refactoring