added lzero() to count leading zeroes