better proxy code