Let's hear it for APIs! :D On a related note, you may want to look into using sockmarks instead of global variables to retain data.