Diagnostics - generating function code