Added printMessage method for printing to console