Refactor step_1b() substeps to method.

This commit refactors the substeps in step_1b() into a method. It also tidies up
some of the cases in step_1b().