Added ability to load main layer from xml file