keeping track of number of blocks and implemented restart