Compound cycle detection improved. Added more tests