reorder variable and function placement