fixed as per commemnts to not override the method parameters value and instead to use ocal variable