Move operation context routines to own file