Change Node to use totalSamples and calculate value from it.
Node refactoring