Parse event loop with custom handlers