add logging and organize for 3 event loops (wip)