flatten consecutive or's and and's

Check if the right subtree contains the same boolean joiner as the
current subtree and add it to existing subtree if so