X11 refactor