isolate proxy handling into its own file