`x | 0` rather than `+x`? Then you can drop the NaN checks below and just check that pid > 0.