Update logic.coffee

Adds more specificity, but removes necessity of being a direct descendant of the root node.