Move codes to bottom so logic comes first