added code to make proxy host if needed.