Rewrote tests. Fixed code that didn't pass tests.