Adds separate db for testing, changes some bugs in payload processing.