Fix Depth and Height to use the block cost, instead of 1. Fix the Height computation (max instead of min).