Refactored XLayer class