Modified code to make test pass