major xml changes and refactoring