Add XPM support and an error window