Fixed confusing variable names and associated errors