Code refactoring (part 2)