add proxy support and remove trailing spaces.