reorder the code and add an include