This function is non trivial and deserves to be commented (I know it is not necessary the scope of this commit)