Major refactoring: moved duplicated generic code to the parent implementations of NamespaceHandler and PredicateHandlerImpl.