Remote file system2

I haven't changed tgoettlicher's commit, just rebased it against master so this part doesn't necessarily need to be reviewed again.

Supersedes #248