Add tests, fix stuff