Added methods to remove environment and fixed issues with environment switching