some style refactoring for clarity