functions rearrangement