Juste an addaptation from original source code www.openconterto.org