branch code improve