Making distribution work with older Awks

Old Awk doesn't have a sort function that can sort numerically. I've
added a quick sort function to make up for this so it should be more
portable.