Bugfixes, unit tests, candy!

i lied about there being candy