changed printmessage to an inline function