rewrite exercise #2 of pancakes and various cleanups