push settings out to a function. Fixes #115.