Overhaul internals and add recursion

This commit adds a few things. Namely, the logic is now recursive,
allowing filters to be set at any level, and supports a foreach_node
directive, which will loop subsequent tasks one-by-one over each node
matching the current filter.
Merge branch 'dev'