Revert "Clean up remote.py and misc.py changes."

This reverts commit 74eff43ee1a2b73159277370cfa9d194e42bf49c.
Revert "Handle raw data I/O."

This reverts commit 257e1459fa064701d789f0ad54384bb80b45e6d9.