Semi-working coding (at least can detect pulse)