Added support for load balancing policies. Cleaned up connection logic.