Refactors code for adding HA repos.