Added some JavaDoc and removed some unnecessary code.