func: function endVesting(address _addressToEnd, address _addressToRefund)
          public
          onlyOwner
          vestingScheduleConfirmed(_addressToEnd)
          addressNotNull(_addressToRefund)
      {
          VestingSchedule storage vestingSchedule = schedules[_addressToEnd];
  
          uint amountWithdrawable = 0;
          uint amountRefundable = 0;
  
          if (block.timestamp < vestingSchedule.cliffTimeInSec) {
              amountRefundable = vestingSchedule.totalAmount;
          } else {
              uint totalAmountVested = getTotalAmountVested(vestingSchedule);
              amountWithdrawable = safeSub(totalAmountVested, vestingSchedule.totalAmountWithdrawn);
              amountRefundable = safeSub(vestingSchedule.totalAmount, totalAmountVested);
          }
  
          delete schedules[_addressToEnd];
          require(amountWithdrawable == 0 || vestingToken.transfer(_addressToEnd, amountWithdrawable));
          require(amountRefundable == 0 || vestingToken.transfer(_addressToRefund, amountRefundable));
  
          emit VestingEndedByOwner(_addressToEnd, amountWithdrawable, amountRefundable);
      }