Refactor models