Added events header, and fleshed out the run loop a little more.