Made options/popup more dynamic

Backported a few fixes/updates/improvments from XBuilder port