controller code factorisation