nir's code with proxy