Fixed indentation, added javadoc, cleanup