Corrected getLength
Added branch blocks to generator