Starting to refactor for better decoupling