great refactoring, simplify XML input