Completely refactored mirror functions.

We wanted to be able to use the same operations to mirror remote-to-local and local-to-remote. We haven't implemented that yet, but this was the larger part of the battle.

We removed some debugging-related print statements.