more semi-functional sort stuff