added logical AND and OR (again) and fixed a sneaky bug