Improve variable names and add comments