Modified for using 'pathos' package