generic refactoring - 1st iteration, moving file manager to a separate lib