small changes and socket reuse