refacted code to subtract one from the  when removing an item from the list