Moving sort function

Moving this as it's not necessary to run once for every role added. It greatly speeds up loading themes (including during mafia updates, since themes are reloaded there), as I noticed when running a theme with over 950 roles :x