Modularise the SP workflow