Refactor authz predicates and fix #189