Move sort_fields declaration.