changed setMessages to println, and some debugging