code motion and printing removal