modified block_function