First full implementation; all tests pass