function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
    uint256 tokenCount = balanceOf(_owner);
    if (tokenCount == 0) {
        
      return new uint256[](0);
    } else {
      uint256[] memory result = new uint256[](tokenCount);
      uint256 totalCards = totalSupply();
      uint256 resultIndex = 0;

      uint256 cardId;
      for (cardId = 0; cardId <= totalCards; cardId++) {
        if (cardIndexToOwner[cardId] == _owner) {
          result[resultIndex] = cardId;
          resultIndex++;
        }
      }
      return result;
    }
  }