Trying to make $pid global.