Added ComplexEntity and tests