Further refactoring for clarity