Francisco's changes + compilation fix

I had to rebase Francisco's changes (to fix a merge issue), and added a compilation fix.


@Andy: if you could do a quick check and merge this please?