move the print-statements to capture error/warnings in ```code```