Added some fixes and new tests that don't run so far.