Refactor middleware injection to be namespaced LIKE A BOSS