moving all generator code to Generator class and Generator class to main package