sync comments, fix function header, rename variable name to follow coding style.