Completed script to initialize environments