Rewrite the @sort_direction variable