Fixed logging and reworked the way new connections are handled