Write method to make test pass using collect