add comments and rename function and variable