add funcs and debug to work