disconnect handler and logging implemented