Updated to use PrimitiveFactory