turning it into a function

turned the previous code into a function so it could spit out a key and a message.