Refactor to not traverse list more than needed
Passed test for filter for !- 1001
Changed existing test so that it tests the boundries