Final code that passes all 22 tests.