Added checking for correct branch.