Added a few test cases, and fixed a grievous defect with exponents.