added a new environment feature and several fixes