small tweaks
some pseudo code for kwok-lau alg