Updated with proxy handling