minor refactoring to conditions