heart beaten function added.