Changed getpid/getppid to function