move the heartbeat to its own thread instead of a timer