reorded some functions