adding helper function which checks if a block exists