Implementation of sort
Sorted implementations