refactor Christophe's code