Working pulse and heartbeat code