Small fix and started working on a rewrite using xcb instead of Xlib.