swapped to using a context object