Compiler warning fixes, mostly related to shadowing local vairables
Compiler warnings fixed by removing deprecated methods
Fixed compiler warning due to unused local function
Fixed crashes due to access to deallocated memory