Tweaks from Alex Stangl or inspired by his comments, and just plain cleanups