Moved printMessage statements to inside the if loop so that they are not printed each time getInstance is called
Moved printMessage statements to inside the if loop so that they are not printed each time getInstance is called