General re-factoring