Clean up some stuff, including a few spots where exceptions were not being handled correctly.