Refactored out server connection