Implement panic() and recover() builtins

Also some minor unrelated cleanups.