Updated to run in child process