Issue #24 part 3: refactoring for more clarity