Fixed GetQueryKey; refactored ObjectFactory