Context factory implementation