Added workflow cancellation, restarting and additional code cleanup.