write a new sort method