switch sort function definition.