added UseTor flag
kind of messy, but allow for tor. need to clean this up so that it is a bit more general.