typo fixed, calculation of i1 and i2 moved to other place
constanst renamed