encode, count && wip decode