replaced the println with a pattern match to decompose the message