more cleanup
canonical order of operands
minor simplification of array test