new function for calculating distance of blocks added