Added some tests cases.
Currently giving unexpected results.
Corrected index errors - now working as expected