Sort method.