function rearranging