Heartbeat support

Fixes #44 
Closes #22 

Opened PR for discussion