By the way. I can't really say I understand this code, I just copied the format for `chdir`