formating code for functions generating, add error for missing which