renamed some variables for clarity