refactor and proxy fix