Refactored XLayers class