added context factory to remove some dependencies