Refactor message handling core
Fix broken tabs