fully functional distance vector algorithm with debugging comments