first part of sort