rm environment dynamic implementation