Refactor connections to the models