rearranged main