WORKING VERSION WITH XML