api proxy slight refactoring