simplify event loop recipe in cookbook a little