Refactor the framework in order to remove some of the magic.