function vestedAmount(ERC20Basic token) public view returns (uint256) {
        UrbitToken urbit = UrbitToken(token); 
        if (!urbit.saleClosed()) {
            return(0);
        } else {
            uint256 currentBalance = token.balanceOf(this);
            uint256 totalBalance = currentBalance.add(released[token]);
            uint256 saleClosedTime = urbit.saleClosedTimestamp();
            if (block.timestamp >= duration.add(saleClosedTime)) { 
                return totalBalance;
            } else {
                return totalBalance.mul(block.timestamp.sub(saleClosedTime)).div(duration); 

            }
        }
    }