add comments, rename variable, and better syntax