rearrange some functions