Refactor getFromFile