add hooks to allow script to be run in parallel