first working version of generator