rearranged order of functions