defunctionalize all the functions