The previous system was kind of hacky and made things a bit inflexible. This improves that system quite a bit and also adds unit tests for the hook variable functionality.