Inserted some more assertions
Updated a docstring