major refactor and introduction of generator class
refactor refactor