Modify global context to be per program to support running of more than one program.
Error checking for context NULL