RR: debugging bash script for finalisation.
RR: tweeaked finalise script.