restructure some function stuff.