slightly improved azure code