large progress on code generationtion. many helper functions are now completed