move checking of data to model