Added individual pattern matches and moved recurse and send into functions.
seperated type of message from value