refactor models and views