made generating function better,
now has first element index of cell