function release(uint256 _index, address _merchantAddress, uint256 _merchantAmount) public ownerOnly {
        require(
            lockStatus[_index] == false,
            "Already released."
        );
        
        LockRecord storage r = lockRecords[_index];
        
        require(
            r.releaseTime <= block.timestamp,
            "Release time not reached"
        );
        
        require(
            _merchantAmount <= r.amount,
            "Merchant amount larger than locked amount."
        );

        
        if (_merchantAmount > 0) {
            require(md.transfer(_merchantAddress, _merchantAmount));
        }
        
        uint256 remainingAmount = r.amount.sub(_merchantAmount);
        if (remainingAmount > 0){
            require(md.transfer(r.userAddress, remainingAmount));
        }

        lockStatus[_index] = true;
        emit Release(r.userAddress, _merchantAddress, _merchantAmount, r.releaseTime, _index);
    }