A few improvments (thanks to benoitc review).