Refactor modeldatasource