Further refactoring for clarity.