Modified variable names, comments added