added printf() function to debug code