moving print commands to functions