Modification made by Loic Denis in order to make it work.