don't compare with false/true, just use the boolean value as is.

could be a good idea to write and split this big condition in several well-named variables.