Added an unfinished unit test. Also found a bug, but I'm out of time so it'll have to wait until later.