Refactoring precedence logic, moving outside of nodes module.
Merge pull request #3 from leonardt/refactor-precedence-handling

Refactoring precedence logic, moving outside of nodes module.