Refactor tree_to_cuboid to tree_to_xndarray. Fix it and add docstring

Also did some cleaning in io.py to remove useless Xml <-> xndarray features