added javadoc and fixed some bad indentation