Put bloc height extraction in a function