Preparing checkBransch function