This method is a little nasty and not really good, but it works faster (I think).
Instead of boolean enter your integer parameter. Each time a similar button is clicked, add a +1 value to it, and whenever you read this data, you just need to confirm that it is odd or even. Odd for like, even for not similar, or vice versa.
source share