The way I did my event loop doesn't seem to be too sound.