Refactoring file loading code for brevity.