Refactor file receiver logic.