Some refactoring of proxy code