Passing all tests
Refactor to use slice and forEach
Finished refactoring