add comments, and fix boundary nan case
Merge branch 'master' of https://github.com/jrising/research-common