Initial implementation of phase2 unwind

Need some better/more test cases for this.