refactor models