Refactoring, tests, and bug fixes

It'll be rock solid this year, I can prove it!