Test refactor (reduce nesting)