finished first version of generator2