cleaned up sort.cpp