first semi-working version of generator