added clock cycle delay logic