Context was changed to a global variable. This allowed the context bases to be determined, but there may be cases where this use of a global variable may cause incorrect data in the output. Further investigation required.