Removed the need to switch off shadowing warning by fixing the code itself.