Adds reduce function to Node

* simple while loop reduces a more complex expression in main file