refactored and refined amd tagging