Add support for multiple branches

Untested.