made a start with replication
Updated pouchds and fixed some bugs.