added function get_env to make retrieving environment variables more readable. Also added system call chdir to handle current directory movement