Sort functions. I've been inlining these for too long now.