sort functions added

code still to be added to rerrange notes in the page