merge with julien's code