add a simple main/event loop