refactory model class