Only declare node variables inside node declaration.
Fix for Issue #119
(also reformatted with spaces hence what looks like massive changes...)