new version correcting n/2 and longer names