delete unused variable
better logs
improve socket handling