Added assertions to enforce preconditions defined in doc comments. Tweaked doc
comments.