(1) allow specifying function and empty hierarchies (2) code formatting