contract Ownable {
    address public owner;
    address[] public managers;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /// @dev The Ownable constructor sets the original `owner` of the contract
    ///      to the sender.
    constructor() public {
        owner = msg.sender;
        managers.push(msg.sender);
    }

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

    modifier onlyManager() {
        require(isManager(msg.sender));
        _;
    }

    function isManager(address manager) view internal returns (bool ok) {
        for (uint i = 0; i < managers.length; i++) {
            if (managers[i] == manager) {
                return true;
            }
        }
        return false;
    }

    function addManager(address manager) onlyOwner public {
        require(manager != 0x0);
        require(!isManager(manager));
        managers.push(manager);
    }

    function removeManager(address manager) onlyOwner public {
        require(manager != 0x0);
        require(isManager(manager));
        for (uint i = 0; i < managers.length; i++) {
            if (managers[i] == manager) {
                managers[i] = managers[managers.length - 1];
                break;
            }
        }
        managers.length -= 1;
    }

    /// @dev Allows the current owner to transfer control of the contract to a
    ///      newOwner.
    /// @param newOwner The address to transfer ownership to.
    function transferOwnership(address newOwner) onlyOwner public returns (bool success) {
        require(newOwner != 0x0);
        removeManager(owner);
        addManager(newOwner);
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
        return true;
    }
}
/// @title Ownable
/// @dev The Ownable contract has an owner address, and provides basic
///      authorization control functions, this simplifies the implementation of
///      "user permissions".
function transferOwnership(address newOwner) onlyOwner public returns (bool success) {
    require(newOwner != 0x0);
    removeManager(owner);
    addManager(newOwner);
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
    return true;
}

/// @dev Allows the current owner to transfer control of the contract to a
///      newOwner.
/// @param newOwner The address to transfer ownership to.