a lot of work on generating xml for sending to server