Fixed: Refactor the flattening code
Improved the management of QName