server now echos xml tree back to client
refactored the stanza building code into its own file