pulled delete to outside of append loop