extracted diamond free generation into a new module. Rearranged utils