Refactoring of distributed architecture to support multiple database replication