Gutted the buffer sorting function.