Refactored. Fixed a bug, but I don't have the tests to prove it. Ooops.