Complete rewrite; better split between client/server, move data handling to FS.Data class, and support streams