Changed calculation of weight by average length of blocks.