start of helper code gen