Some cleanup and socket listener loop

Preparing for v1.2.0.0