Cleans up some code and continues writing tests.