fixing iteration bug as we were removing element from list on which we are iterating