Added gram counting.