patterns refactoring (part 1/2)