Adds sort functions