refactoring: use faster short circuit evaluation