refactor cod