Refactor obfuscator middleware