Pio's changes work if some parts of Pepe's code are omitted