Added tests for heartbeat
Implemented heartbeat