Fixed block and definition functions. Need tests but should be OK.