added the -d flag and added some pre-work for tagging