Another refactoring. Experimenting different ways to organize the code.