This code can be used to sort high scores. You can copy it into your program. It uses several variables, but as long as your scores are put into a "data" list it should work ok. Run it once, and it'll create all of the needed variables. When adding to the list, be sure to have the sortable number, followed by a space. Anything after the space will be ignored. For example, add "23 by Nathan" to the list to sort it as 23. When you call it, be sure to pass in the maximum number of high scores. E.G., sort scores 10 will return the top 10 items.
If you want to watch it sort, then turn on the screen refresh. This uses a simple bubble sort.