Fix errors
Improved Balancer
Added tests for replication and balancer