my horrible code for xml parsing