adding complete heartbeat functionality