add comments and change some variable names