use reverse loop with deletions