cod refactor