Add a sort method that copies the keys