Use redirect as default initialisation function
Adding init and finalize parameters to the main functions.
Added init and finalize parameters to the internal functions
Call init and finalize in the workers and in the finish function of setup_chan