put printing in own function