added sample event loop