Changed IO to use rising edges