Added logging and eviron valiables