re-factoring and rewriting