Some minor refactoring of our file manager [ci skip].