finished implementing contiguous solution