refactoring - created TypeGenerator class