Please add a comment about what these function do and why they are necessary. To a person who never has anything to do with heartbeats this will be helpful.