Making heartbeat a setInterval instead of a settimeout