Changed NValue to global variable