Refactored running processes to a method