Syntax error on line 22: unpaired '{' .
        if (state == active) {
