use blocks for logging, fix reconnect attempts, add tests