Simplify nested logic in expandedStates handling
- Extract nested else-if logic into clearer flow
- Add explanatory comment about trying to find fitting state
- Use boolean flag to avoid redundant condition checks
- Improves readability without changing behavior
Co-authored-by: fisker <172584+fisker@users.noreply.github.com>