Refactor addConnection to manageable pieces
Break out server to separate file