simplify branch code