sort out ordering of tags and items