improved to handle all comparison operators + negate some constraints