moved printf to its own function