Completed JavaDoc and cleaned up code.