Adds better check for current_branch function