refactoring ads