minor refactoring for clarity