Modified script to get heart rate