Refactoring send_file_response subroutine.