fix code order for better comprehension