adding some assert statements
some small changes
some small changes