Lots of cleanups and fixes for 20131105