added logic to pass dependencies to function through this pointer.