added printf function for formatted output