Refactoring the filemanager class