Refp2

Refactored the Pass 2 method with a switch structure. The need_base() method needs to be refactored with the proper functions. When need_base() is omitted the code runs the same as the original.