added asserts and clone detection