@catchmrbharath : the conditions in the if's are meant to overlap. http://www.swarthmore.edu/NatSci/echeeve1/Ref/mna/MNA5.html