Made the variable names more descriptive.
Factored out integer division, in case we ever want to use other algorithms for it.
Made the integer division class more explicit in what it's doing. Also, added a division-by-zero exception, to catch it before it happens, and added exception-handling code to the procedures that use the code that potentially throws division by zero.

In addition, the exception type I used for the invalid comparison was wrong. I've corrected it here.
Merge pull request #75 from joezeng/master

Naming cleanup