Both implementations to detect pulse