adjusted some variable names for clarity