Refactor the process detection methods