Updated to use blocks.