more code factorisation