Refactor incompatible data type metric. Add tests.
Refactor homogeneous datatype.