- added some extra assertions to the code