cleaned up socket constructor