contract PausableToken is StandardToken, Ownable {
    event Pause();
    event Unpause();

    bool public paused = false;
    mapping(address => bool) public whitelist;

    /**
    * @dev called by the owner to pause, triggers stopped state
    */
    function pause() onlyOwner public {
        require(!paused);
        paused = true;
        emit Pause();
    }

    /**
    * @dev called by the owner to unpause, returns to normal state
    */
    function unpause() onlyOwner public {
        require(paused);
        paused = false;
        emit Unpause();
    }
    /**
     * @notice add/remove whitelisted addresses
     * @param who Address which is added or removed
     * @param allowTransfers allow or deny dtransfers when paused to the who
     */
    function setWhitelisted(address who, bool allowTransfers) onlyOwner public {
        whitelist[who] = allowTransfers;
    }

    function transfer(address _to, uint256 _value) public returns (bool){
        require(!paused || whitelist[msg.sender]);
        return super.transfer(_to, _value);
    }

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool){
        require(!paused || whitelist[msg.sender] || whitelist[_from]);
        return super.transferFrom(_from, _to, _value);
    }

}
/**
 * @title Pausable Token
 * @dev Token that can be paused and unpaused. Only whitelisted addresses can transfer when paused
 */
function pause() onlyOwner public {
    require(!paused);
    paused = true;
    emit Pause();
}

/**
 * @dev called by the owner to pause, triggers stopped state
 */