Refactor common operations between verify and dedup
Hoist common declarations and initializations out of main