base64 encoding is expensive enough to make it worth precalculating the encoded pid just in case we want to reuse it.