added functionality (from grammar matrix) to sort the choices file. I probably included more than is necessary