converted the loger to return count