Added some tweaks to branch functions.