Fix xdd v2

Reworked fix-xdd branch as suggested!