added support for $or, $and, $nor and $not