Refactors tags into priority