contract QRL_Token is StdToken {
     string public name = "QRL";
     uint public decimals = 8;
     string public symbol = "QRL";
     address public creator = 0x0;
     uint freezeblock = 0;
     modifier notFrozen() {
          if ((freezeblock != 0) && (block.number > freezeblock)) throw;
          _;
     }
     modifier onlyPayloadSize(uint numwords) {
          if (msg.data.length != numwords * 32 + 4) throw;
          _;
     }
     modifier onlyInState(State state){
          if(currentState!=state)
               throw;
          _;
     }
     modifier onlyByCreator(){
          if(msg.sender!=creator)
               throw;
          _;
     }
// Functions:
     function transfer(address _to, uint256 _value) notFrozen onlyPayloadSize(2) returns (bool success) {
          if((balances[msg.sender] >= _value) && (balances[_to] + _value > balances[_to])){
               balances[msg.sender] -= _value;
               balances[_to] += _value;
               Transfer(msg.sender, _to, _value);
               return true;
          } else { 
               return false; 
          }
     }
     function transferFrom(address _from, address _to, uint256 _value) notFrozen onlyPayloadSize(2) returns (bool success) {
          if((balances[_from] >= _value) && (allowed[_from][msg.sender] >= _value) && (balances[_to] + _value > balances[_to])){
               balances[_to] += _value;
               balances[_from] -= _value;
               allowed[_from][msg.sender] -= _value;
               Transfer(_from, _to, _value);
               return true;
          } else { 
               return false; 
          }
     }
     function approve(address _spender, uint256 _value) returns (bool success) {
          //require user to set to zero before resetting to nonzero
          if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) {
               return false;
          }
          allowed[msg.sender][_spender] = _value;
          Approval(msg.sender, _spender, _value);
          return true;
     }
     function QRL_Token(){
          creator = msg.sender;
     }
     enum State {
          Start,
          Closed
     }
     State public currentState = State.Start;
     function freeze(uint fb) onlyByCreator {
          freezeblock = fb;
     }
     function issueTokens(address forAddress, uint tokenCount) onlyInState(State.Start) onlyByCreator{
          balances[forAddress]=tokenCount;
          
          // This is removed for optimization (lower gas consumption for each call)
          // Please see 'setAllSupply' function
          //
          // allBalances+=tokenCount
     }
     // This is called to close the contract (so no one could mint more tokens)
     function close() onlyInState(State.Start) onlyByCreator{
          currentState = State.Closed;
     }
     function setAllSupply(uint data) onlyInState(State.Start) onlyByCreator{
          allSupply = data;
     }
     function changeCreator(address newCreator) onlyByCreator{
          creator = newCreator;
     }
}
function close() onlyInState(State.Start) onlyByCreator{
          currentState = State.Closed;
     }
// This is called to close the contract (so no one could mint more tokens)