extending block with a new flag and an end function