Small changes in logging function
Changed connection dispatching mechanism a bit