added functionality for multiple environments, very buggy