Detecting USB Flash Devices (plugged and hot-plugged)

I am trying to script the process of looking for a usb-key inside another application. I have gotten some success by recording "ls /dev" and comparing it to a new "ls /dev" periodically.

However this has made it so I have to prompt the user to take out the usb-key (if plugged in), let my script know (so it can "ls /dev" a baseline), plug the usb-key back in (so it can "ls /dev" a comparison after 3 second sleep), and finally loop through mount attempts till I find one that doesn't error (of the 2-3 detected - like sdb, sdb1, sdb2 - only sdb1 is actually the drive - though all three appear), and if multiple are mountable (cause who knows what else could have simultaneously happened in the /dev directory), ask the user to pick.

Is there a better way? (no hotplug [the app] support, sorry)

If this is a HAL system, look into lshal -m