Building counting matrix works