Testing

Fixes broken tests and adds a whole bunch of new ones.