Sort to ensure ordering.