rearrange function calls