added tests, which made me fix a bug. yay tests.