more tidying and tweaking in machine in preparation for the final operation tweaks to write required header values in varying handler cases