CODE REFACTORING (AD FORM)