renamed variables, changed detecting pids, etc