Improve replication
PEP8 compliant; remove legacy unused code; bugfixes Special thanks to Chyssler for pointing them out
Infrastructure for automatic remote replication.
Giant rollup commit in preperation for 8.0-RC4