Small refactoring of proxy handling