Index: ql/cashflows/cashflowvectors.cpp
===================================================================
--- ql/cashflows/cashflowvectors.cpp	(revision 12828)
+++ ql/cashflows/cashflowvectors.cpp	(working copy)
@@ -90,6 +90,39 @@
         QL_REQUIRE(!couponRates.empty(), "coupon rates not specified");
         QL_REQUIRE(!nominals.empty(), "nominals not specified");
 
+		std::vector<InterestRate> interestRates(couponRates.size());
+
+        if (schedule.isRegular(1)) {
+            QL_REQUIRE(firstPeriodDayCount.empty() ||
+                       firstPeriodDayCount == paymentDayCounter,
+                       "regular first coupon "
+                       "does not allow a first-period day count");
+			interestRates[0] = InterestRate(couponRates[0],paymentDayCounter,Simple,Annual);
+        } else {
+            DayCounter dc = firstPeriodDayCount.empty() ?
+                            paymentDayCounter :
+                            firstPeriodDayCount;
+			interestRates[0] = InterestRate(couponRates[0],dc,Simple,Annual);
+        }
+
+        for (Size i=1; i<couponRates.size(); ++i) {
+			interestRates[i] = InterestRate(couponRates[i],paymentDayCounter,Simple,Annual);
+		}
+		return FixedRateLeg(nominals,
+                     schedule,
+                     interestRates,
+                     paymentAdj);
+
+	}
+
+	Leg FixedRateLeg(const std::vector<Real>& nominals,
+                     const Schedule& schedule,
+                     const std::vector<InterestRate>& couponRates,
+                     BusinessDayConvention paymentAdj) {
+
+        QL_REQUIRE(!couponRates.empty(), "coupon rates not specified");
+        QL_REQUIRE(!nominals.empty(), "nominals not specified");
+
         Leg leg;
 
         // the following is not always correct
@@ -98,30 +131,24 @@
         // first period might be short or long
         Date start = schedule.date(0), end = schedule.date(1);
         Date paymentDate = calendar.adjust(end, paymentAdj);
-        Rate rate = couponRates[0];
+        InterestRate rate = couponRates[0];
         Real nominal = nominals[0];
         if (schedule.isRegular(1)) {
-            QL_REQUIRE(firstPeriodDayCount.empty() ||
-                       firstPeriodDayCount == paymentDayCounter,
-                       "regular first coupon "
-                       "does not allow a first-period day count");
             leg.push_back(boost::shared_ptr<CashFlow>(new
-                FixedRateCoupon(nominal, paymentDate, rate, paymentDayCounter,
+                FixedRateCoupon(nominal, paymentDate, rate,
                                 start, end, start, end)));
         } else {
             Date ref = end - schedule.tenor();
-            ref = calendar.adjust(ref, schedule.businessDayConvention());
-            DayCounter dc = firstPeriodDayCount.empty() ?
-                            paymentDayCounter :
-                            firstPeriodDayCount;
+            ref = calendar.adjust(ref,
+                                        schedule.businessDayConvention());
             leg.push_back(boost::shared_ptr<CashFlow>(new
                 FixedRateCoupon(nominal, paymentDate, rate,
-                                dc, start, end, ref, end)));
+                                start, end, ref, end)));
         }
         // regular periods
         for (Size i=2; i<schedule.size()-1; ++i) {
             start = end; end = schedule.date(i);
-            paymentDate = calendar.adjust(end, paymentAdj);
+            paymentDate = calendar.adjust(end,paymentAdj);
             if ((i-1) < couponRates.size())
                 rate = couponRates[i-1];
             else
@@ -131,14 +158,14 @@
             else
                 nominal = nominals.back();
             leg.push_back(boost::shared_ptr<CashFlow>(new
-                FixedRateCoupon(nominal, paymentDate, rate, paymentDayCounter,
+                FixedRateCoupon(nominal, paymentDate, rate,
                                 start, end, start, end)));
         }
         if (schedule.size() > 2) {
             // last period might be short or long
             Size N = schedule.size();
             start = end; end = schedule.date(N-1);
-            paymentDate = calendar.adjust(end, paymentAdj);
+            paymentDate = calendar.adjust(end,paymentAdj);
             if ((N-2) < couponRates.size())
                 rate = couponRates[N-2];
             else
@@ -150,14 +177,15 @@
             if (schedule.isRegular(N-1)) {
                 leg.push_back(boost::shared_ptr<CashFlow>(new
                     FixedRateCoupon(nominal, paymentDate,
-                                    rate, paymentDayCounter,
+                                    rate,
                                     start, end, start, end)));
             } else {
                 Date ref = start + schedule.tenor();
-                ref = calendar.adjust(ref, schedule.businessDayConvention());
+                ref = calendar.adjust(ref,
+                                            schedule.businessDayConvention());
                 leg.push_back(boost::shared_ptr<CashFlow>(new
                     FixedRateCoupon(nominal, paymentDate,
-                                    rate, paymentDayCounter,
+                                    rate,
                                     start, end, start, ref)));
             }
         }
Index: ql/cashflows/cashflowvectors.hpp
===================================================================
--- ql/cashflows/cashflowvectors.hpp	(revision 12828)
+++ ql/cashflows/cashflowvectors.hpp	(working copy)
@@ -34,6 +34,7 @@
 #include <ql/time/businessdayconvention.hpp>
 #include <ql/time/daycounter.hpp>
 #include <ql/utilities/null.hpp>
+#include <ql/interestrate.hpp>
 
 
 namespace QuantLib {
@@ -49,6 +50,10 @@
                      const DayCounter& paymentDayCounter,
                      BusinessDayConvention paymentAdjustment = Following,
                      const DayCounter& firstPeriodDayCounter = DayCounter());
+    Leg FixedRateLeg(const std::vector<Real>& nominals,
+                     const Schedule& schedule,
+                     const std::vector<InterestRate>& couponRates,
+                     BusinessDayConvention paymentAdjustment = Following);
 
     //! helper function building a sequence of par coupons
     /*! Either UpFrontIndexedCoupons or ParCoupons are used depending
Index: ql/cashflows/fixedratecoupon.hpp
===================================================================
--- ql/cashflows/fixedratecoupon.hpp	(revision 12828)
+++ ql/cashflows/fixedratecoupon.hpp	(working copy)
@@ -27,6 +27,7 @@
 
 #include <ql/cashflows/coupon.hpp>
 #include <ql/time/daycounter.hpp>
+#include <ql/interestrate.hpp>
 
 namespace QuantLib {
 
@@ -43,7 +44,18 @@
                         const Date& refPeriodEnd = Date())
         : Coupon(nominal, paymentDate, accrualStartDate, accrualEndDate,
                  refPeriodStart, refPeriodEnd),
-          rate_(rate), dayCounter_(dayCounter) {}
+          interestrate_(InterestRate(rate,dayCounter,Simple,Annual)) {}
+
+        FixedRateCoupon(Real nominal,
+                        const Date& paymentDate,
+                        const InterestRate& interestrate,
+                        const Date& accrualStartDate,
+                        const Date& accrualEndDate,
+                        const Date& refPeriodStart = Date(),
+                        const Date& refPeriodEnd = Date())
+        : Coupon(nominal, paymentDate, accrualStartDate, accrualEndDate,
+                 refPeriodStart, refPeriodEnd),
+          interestrate_(interestrate) {}
         //! \name CashFlow interface
         //@{
         Real amount() const;
@@ -51,38 +63,44 @@
         //! \name Coupon interface
         //@{
         Rate rate() const;
-        DayCounter dayCounter() const { return dayCounter_; }
+        DayCounter dayCounter() const { return interestrate_.dayCounter(); }
         Real accruedAmount(const Date&) const;
+        InterestRate interestrate() const;
         //@}
         //! \name Visitability
         //@{
         virtual void accept(AcyclicVisitor&);
         //@}
       private:
-        Rate rate_;
-        DayCounter dayCounter_;
+		InterestRate interestrate_;
     };
 
 
     // inline definitions
 
     inline Real FixedRateCoupon::amount() const {
-        return nominal()*rate_*accrualPeriod();
+            return nominal()*(interestrate_.compoundFactor(accrualStartDate_,
+							accrualEndDate_,
+                            refPeriodStart_,
+                            refPeriodEnd_)-1);
     }
 
     inline Rate FixedRateCoupon::rate() const {
-        return rate_;
+        return interestrate_.rate();
     }
 
+    inline InterestRate FixedRateCoupon::interestrate() const {
+        return interestrate_;
+    }
+
     inline Real FixedRateCoupon::accruedAmount(const Date& d) const {
         if (d <= accrualStartDate_ || d > paymentDate_) {
             return 0.0;
         } else {
-            return nominal()*rate_*
-                dayCounter_.yearFraction(accrualStartDate_,
-                                         std::min(d,accrualEndDate_),
-                                         refPeriodStart_,
-                                         refPeriodEnd_);
+            return nominal()*(interestrate_.compoundFactor(accrualStartDate_,
+							std::min(d,accrualEndDate_),
+                            refPeriodStart_,
+                            refPeriodEnd_)-1);
         }
     }
 
Index: ql/time/calendar.cpp
===================================================================
--- ql/time/calendar.cpp	(revision 12828)
+++ ql/time/calendar.cpp	(working copy)
@@ -122,10 +122,7 @@
                                              bool includeFirst,
                                              bool includeLast) const {
         BigInteger wd = 0;
-        if (from == to) {
-            if (isBusinessDay(from) && (includeFirst || includeLast))
-                wd = 1;
-        } else {
+        if (from != to) {
             if (from < to) {
                 Date d = from;
                 while (d <= to) {
