added sort functions all working