Refactor dynamic analysis helper