documentation and function clean up, leaving generics for nvars/ncases and better...