implemented generate model