Refactored the delete tags from file to have less queries.