Fix typo.
Remove use of assert statements since this does not conform to general best practice.

This is unfortunate, because the code is much more verbose than before and NOT as clear.