moved CN calculation