saving messages in a tree (still needs work)