Added plenty more tests, squashed some bugs