reorganized the result backtrace filtering logic

This is just a minor reorg and cleanup - no behavior changes.