Factorization of code into slave