Functional

Move snowmew's gameloop to a more functional style.