Unmatched brackets checking added