added sort functions