PR remarks: return -1 for pid, split if-then-else
Check for -1 to avoid HUPping all the things