relocated some functions