Cleanup, nasty bug fixes.