factorisation and debug