remove stack allocated pointers

remove the stack allocated pointers used to access different structures
within the lib.