Add some basic code factorization