Added invert method. Fixed a whole bunch of tests that weren't actually being run.