reorder case logic