debruijn log2, minor refactorings