massive work on logging and a bit connection handling