Update branch.py to work with a cache