added sort function, all is well