some clean up and implementing heartbeat functionality