added compute_blocks and block class