moved some functions