move model creation to factory