added some debug code that prints the array to the console)