Fixes based on Noah's feedback, and some cleanup.