- refactored findFlags()
- fixed tests reporting incorrect results