rearranging order of functions