Fixed logic with removing list items while looping through list.