Minor changes wrt to the previous submission, so as to avoid running some stuff twice under some conditions. This is for reference to the next commit fest.
-- Fabien.