Change XML format

+ add pointers for devices (same devices for multiple folders)

Fix some memory leaks (using assignment operator overloading and destructors). Some memory leaks have to be fixed.