Factor out and expose context intialization method