new aproach to indexCharInText