Get proxy settings from enviroment + some minor changes