run_code now includes a pid as well for better randomness