Made the following changes
1] Added doctests and tests
2] Changed the max limit such that it is congruent with
   series
3] Rectified test failures