more improvements based on christophe's review