Implement parenthesis swapping