Version header middleware refactor