Modification of main_env for input and output