Updated inline text scan logic