Support multiple environments

fix #4 #5 #6