implement domain and tests, all tests passing