Tighten up some types; improve some comments.