Structural changes to make more self-contained