optimise tag code
Merge branch 'master' into 652_tag_improvements
Merge pull request #654 from flapjack/652_tag_improvements

optimise tag code