Moved tag logic into separate reusable partial.