Issue #1: Fix incorrect hierarchy at filter stage and add a c++ exception example