Moved some of the server socket handling stuff out to a separate source file