Refactored proxy from GitHub