fixed matching parentheses indexes
clean code
fixed recursive matching parentheses