refactor: cleanup worker events handling in main thread