Testing

Finally adding unit tests! 96% coverage. Fixes #1.