Re-arranging codes