Put copy / paste stuff together; shorter env detection