Since this is a big ball of code, just make the settings part of it even bigger. Let it hold the content.