Re-order elements within grammar