added 3-way sort for integers