Use context instead of global

Also minor code cleanup to use an accessor instead of a member variable

Change-Id: I074eb82458e6963c4453c9a43345eb661ace24a1
Merge "Use context instead of global"