Removing unwanted print commands