updated AND OR NOT logics