Passes all tests.
Cleaned up a bit.