Improving comments and reordering XML functions