Updated Generator to produce cleaner code and remove deprecated functionality.