added new function to get the pid of a thing