Errors fixed, tests pass