Changed socket termination.
Removed reference counting.