functions restructure