writing a sort method first steps