Moved environment functions to a new file.