initializing with a model class