Finished refactoring build_models