EDIT: Edited median sort (under construction).