Added a number of class/method-level javadocs. Added a few comments. Renamed a few variables and one method. Moved three small instations to the head of the mainLoop() method and out of the main loop proper.