added asserts for reduce, added an optional arg to a check function