function getRate() constant returns (uint) {
    bool duringPresale = (now < start) && (weiRaised < presaleCap * 1 ether);
    bool gracePeriodSet = gracePeriodStart != 0;
    bool duringGracePeriod = gracePeriodSet && now <= gracePeriodStart + 24 hours;
    uint rate = 1000;
    
    if (duringPresale) rate = 1300;               
    else if (now <= start +  3 days) rate = 1250; 
    else if (now <= start + 10 days) rate = 1150; 
    else if (now <= start + 20 days) rate = 1050; 
    
    if (duringGracePeriod) return rate.sub(rate.div(10)); 
    
    return rate;
  }