Add const specifiers, update comments, add assert.