code that makes the test pass, refactored afterwards