Correct some errors, add some static_assert constraints, trivial cleanup.