Code reuse for tag and branch list, added more tests.