more refactoring related to guard clauses