Updated main layout with global event
Updated with async