move modelish code to model