added proxy mode code