Add main event loop