added logic to delete files