Refactor XsendFile