cleaned up code and added model fields for generator db fields