Move chdir() into main()