This thing about the comma bothers me, maybe I don't get what your're doing or why you require a comma before you delete it (just sounds wrong and brittle). Should you be using a join? This'll make sure that your separator is not added at the end of the last item in the list.