Remake heartbeat using a thread.