Allow to specify a branch

This finishes my changes from the previous commit