contract Controller {
    
    address private _owner;
    bool private _paused;
    
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    event Paused(address account);
    event Unpaused(address account);
    
    mapping(address => bool) private owners;
    
    /**
    * @dev The Controller constructor sets the initial `owner` of the contract to the sender
    * account, and allows transfer by default.
    */
    constructor() internal {
        setOwner(msg.sender);
    }

    /**
    * @dev Throws if called by any account other than the owner.
    */
    modifier onlyOwner() {
        require(owners[msg.sender]);
        _;
    }

    function setOwner(address addr) internal returns(bool) {
        if (!owners[addr]) {
          owners[addr] = true;
          _owner = addr;
          return true; 
        }
    }

    /**
    * @dev Allows the current owner to transfer control of the contract to a newOwner.
    * @param newOwner The address to transfer ownership to.
    */   
    function changeOwner(address newOwner) onlyOwner public returns(bool) {
        require (!owners[newOwner]);
          owners[newOwner];
          _owner = newOwner;
          emit OwnershipTransferred(_owner, newOwner);
          return; 
        }

    /**
    * @return the address of the owner.
    */
    function Owner() public view returns (address) {
        return _owner;
    }
    
    /**
    * @return true if the contract is paused, false otherwise.
    */
    function paused() public view returns(bool) {
    return _paused;
    }
    
    /**
    * @dev Modifier to make a function callable only when the contract is not paused.
    */
    modifier whenNotPaused() {
    require(!_paused);
    _;
    }
    
    /**
    * @dev Modifier to make a function callable only when the contract is paused.
    */
    modifier whenPaused() {
    require(_paused);
    _;
    }
    
    /**
    * @dev called by the owner to pause, triggers stopped state
    */
    function pause() public onlyOwner whenNotPaused {
    _paused = true;
    emit Paused(msg.sender);
    }
    
    /**
    * @dev called by the owner to unpause, returns to normal state
    */
    function unpause() public onlyOwner whenPaused {
    _paused = false;
    emit Unpaused(msg.sender);
    }
    
}
/**
 * @title Controller
 * @dev The Controller contract has an owner address, and provides basic authorization and transfer control
 * functions, this simplifies the implementation of "user permissions".
 */
function pause() public onlyOwner whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}

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