Refactored ServiceProxyClassFactory to contexts