Final version of generator