update loggging, change ref to ref to const.