(XMB) Code refactoring