Merge with sendfile code by Rick.