Fixed warning for block

Used recursive function isntead of block