mv code to funcs