Use chdir to simplify getting filenames