Fixes more branch encodings. Adds more branch tests.