added sort function back in