There are quite a few `os.path` operations going on in the code. Ideally these should be updated to use `pathlib`.