Started refactoring file handlers