added asserts in place of prints