rename lastId to currentOffset