improved string scanner