Initial version of generator - not working well for many cells