Cleaned up socket handling and comments in packet.cc