An implementation of DiamondAPI