function that does the work

@author Umberto Salsi <salsi@icosaedro.it>
Thanks Umberto