move all functions in functions.lua