changed sortify() helper swapify() to be static inline