Factorize a function and add proper doxy comment.