internally doing 0 based indexing