Added Test cases, fixed the case when there are no chunks, addressed code review