Added two new local functions (sortSpellsByLevel and appendSpellsInfo). The main logic of the onUse function has been retained, but now uses these auxiliary functions to order and generate the text of spells.w