working sort functions

deleted old incorrect files.