Cleanup tokenize_b and hoist some invarients out of the loop. Change-Id: I60401b45b85de8123d16233c2a14abddc1c55041