Refactor server connections