cdn code refactor