Create a separate method for updating global context properly